package com.example.projectcode.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.projectcode.mapper.CpstuanMapper;
import com.example.projectcode.model.Comprehensive;
import com.example.projectcode.model.Cpstuan;
import com.example.projectcode.service.CpstuanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CpstuanServiceImpl extends ServiceImpl<CpstuanMapper, Cpstuan> implements CpstuanService {
    @Autowired
    private CpstuanMapper cpstuanMapper;

    @Override
    public int insertCpstuan(Cpstuan cpstuan) {
        return baseMapper.insert(cpstuan);
    }

    @Override
    public Cpstuan selectCpstuanByCpstuanid(Integer cpStuanid) {
        return baseMapper.selectOne(new QueryWrapper<Cpstuan>().eq("Cp_stuanid",cpStuanid));
    }

    @Override
    public List<Cpstuan> selectAllfalsecomprehensiveByStuId(Integer stuId) {
            return baseMapper.selectList(new QueryWrapper<Cpstuan>().eq("Stu_id",stuId).eq("Cp_feedback","false"));
    }

    @Override
    public List<Cpstuan> selectAllByStuId(Integer stuId) {
        return baseMapper.selectList(new QueryWrapper<Cpstuan>().eq("Stu_id",stuId));
    }

    @Override
    public int updateCpstuanById(Integer cpstuanid, Integer teaid, String teacom) {
        return cpstuanMapper.updateCpstuanById(cpstuanid,teaid,teacom);
    }


}
